import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = 0, count = 1, a = 0, lmin = 0, lmax = 0, min = 0, max = 0, l = 0;
        System.out.println("Enter a:");
        a = scan.nextInt();
        boolean z = true;
//        System.out.println("Enter array length:");
//        n = scan.nextInt();
        int[] arr = new int[]{1, 3, 2, 9, 7, 5, 6, 10, 12, 11, 9};
//        int[] arr = new int[]{0, 2, 1, -1, 3, 1, 0, -1, 4, 6, 5, 3};
//        for (int i = 0; i < n; i++) {
//            System.out.println("Enter value for " + i + ":");
//            arr[i] = scan.nextInt();
//        }
        for (int i = 0; i < arr.length - 1; i++) {
            if (Math.abs(arr[i] - arr[i + 1]) <= a) {
                count++;
            } else {
                if (count >= max) {
                    if (count == max && z) {
                        min = max;
                        lmin = lmax;
                        lmax = l;
                        max = count;
                        z = false;
                    }
                    if (count > max) {
                        min = max;
                        lmin = lmax;
                        lmax = l;
                        max = count;
                        z = true;
                    }
                }
                l = i + 1;
                count = 1;
            }
        }
        if (count > max || z) {
            min = max;
            lmin = lmax;
            lmax = l;
            max = count;
        }
        System.out.println("index=" + lmax + " count=" + max);
    }
}